from mongoengine import DynamicDocument, DynamicField

from app.globals import env


class Account(DynamicDocument):
    account = DynamicField()
    api_type = DynamicField()  # tdx
    enable = DynamicField()
    password = DynamicField()
    yyb_id = DynamicField()
    trade_server = DynamicField()
    port = DynamicField()
    gddm_sz = DynamicField()
    gddm_sh = DynamicField()
    file_path = DynamicField()
    enable_reverse_repo = DynamicField()
    description = DynamicField()

    meta = {
        'indexes': [
            {
                'fields': ['account'],
                'unique': True
            },
            {
                'fields': ['enable']
            }
        ],
        'db_alias': env.db_name,
        'collection': 'account'
    }
